#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source.  A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2015 Garrett D'Amore <garrett@damore.org>
# Copyright 2016 Joyent, Inc.
#

#
# Compilation environments.
#
# Each compilation environment is declared using the keyword "env", like
# this:
#
# env | <name> | <std> | <defs>
#
# <name> is just a symbolic name for environment.
# <std>  indicates either c89 or c99, i.e. which C standard to compile
#        under.  This infuences choice of compiler and switches.
# <defs> is a list of CPP style -D or -U flags to define C preprocessor
#        symbols.
#
# Groups of compilation environments can be named, using the "env_group"
# keyword (this can also be used to create aliases):
#
# env_group | <name> | <envs>
#
# <name> is a name for the group or alias
# <envs> is a whitespace separated list of previously declared environments
#        or environment groups (or aliases).
#

env | XPG3		| c89 | -D_XOPEN_SOURCE
env | XPG4		| c89 | -D_XOPEN_SOURCE -D_XOPEN_VERSION=4
env | SUSv1		| c89 | -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1
env | SUSv2		| c89 | -D_XOPEN_SOURCE=500
env | SUSv3		| c99 | -D_XOPEN_SOURCE=600
env | SUSv4		| c99 | -D_XOPEN_SOURCE=700
env | POSIX-1990	| c89 | -D_POSIX_SOURCE
env | POSIX-1992	| c89 | -D_POSIX_SOURCE -D_POSIX_C_SOURCE=2
env | POSIX-1993	| c89 | -D_POSIX_C_SOURCE=199309L
env | POSIX-1995	| c89 | -D_POSIX_C_SOURCE=199506L
env | POSIX-2001	| c99 | -D_POSIX_C_SOURCE=200112L
env | POSIX-2008	| c99 | -D_POSIX_C_SOURCE=200809L
env | C90		| c89 |
env | C99		| c99 |
env | C11		| c11 |

#
# These are ordered from less inclusive (most recent) to most inclusive.
# This allows for us to "include" by reference.
#
env_group | POSIX-2008+	| POSIX-2008
env_group | POSIX-2001+	| POSIX-2008+ POSIX-2001
env_group | POSIX-1995+ | POSIX-2001+ POSIX-1995
env_group | POSIX-1993+ | POSIX-1995+ POSIX-1993
env_group | POSIX-1992+ | POSIX-1993+ POSIX-1992
env_group | POSIX-1990+ | POSIX-1992+ POSIX-1990
env_group | POSIX+	| POSIX-1990+
env_group | SUSv4+	| SUSv4 POSIX-2008+
env_group | SUSv3+	| SUSv3 SUSv4+ POSIX-2001+
env_group | SUSv2+	| SUSv2 SUSv3+
env_group | SUSv1+	| SUSv1 SUSv2+
env_group | SUS+	| SUSv1+
env_group | XPG4+	| XPG4 SUSv1+
env_group | XPG3+	| XPG3 XPG4+
env_group | C99+	| C99 C11 POSIX-2001+ SUSv3+
env_group | STDC	| C90 C99 C11
env_group | C+		| STDC POSIX+ SUS+
env_group | ALL		| C+

#
# Aliases.
#
env_group | XPG4v2	| SUSv1
env_group | XPG4v2+	| SUSv1+
env_group | XPG5	| SUSv2
env_group | XPG5+	| SUSv2+
env_group | XPG6	| SUSv3
env_group | XPG6+	| SUSv3+
env_group | XPG7	| SUSv4
env_group | XPG7+	| SUSv4+
